<?php
/**
 * Created by PhpStorm.
 * User: cy
 * Date: 18-2-8
 * Time: 上午11:13
 */

class Event extends \Observe\EventGenerateor
{
    public function trigger()
    {
        echo '触发事件<br>';
        $this->notify();//通知观察者
    }
}
class Observe1 implements \Observe\Observer
{
    public function update()
    {
        // TODO: Implement update() method.
        echo '触发逻辑1更新<br>';
    }
}
class Observe2 implements \Observe\Observer
{
    public function update()
    {
        // TODO: Implement update() method.
        echo '触发逻辑2更新<br>';
    }
}

$event = new  Event;
$observe1=new Observe1;
$observe2=new Observe2;

$event->addObserver($observe1);
$event->addObserver($observe2);
$event->trigger();